//
// Created by F1997 on 2024/12/24.
//

#ifndef NETWORK_TRAFFIC_PROCESSING_V2_INIREADER_H
#define NETWORK_TRAFFIC_PROCESSING_V2_INIREADER_H
#include "pch.h"

namespace ntp {
    typedef std::map<std::string, std::string> ss_map;
    class IniReader {
    public:
        IniReader()	{}
        ~IniReader() {}

        bool ReadConfig(const std::string& filename);
        std::string ReadString(const char* section, const char* item, const char* default_value);
        int ReadInt(const char* section, const char* item, const int& default_value);
        double ReadFloat(const char* section, const char* item, const float& default_value);
        std::vector<std::string> GetSimilarConfigNames(const std::string& section);

    private:
        void Trim(std::string& str);
        bool AnalyseLine(const std::string& line, std::string& section, std::string & key, std::string & value);

    private:
        std::map<std::string, ss_map> settings_;
    };

} // ntp

#endif //NETWORK_TRAFFIC_PROCESSING_V2_INIREADER_H
